using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Xid.Controls
{
    public partial class StackPanel : FlowLayoutPanel
    {
        public new FlowDirection FlowDirection
        {
            get
            {
                return base.FlowDirection;
            }
            set
            {
               // base.FlowDirection = value;
            }
        }

        private new bool WrapContents
        {
            get
            {
                return base.WrapContents;
            }
            set
            {
               // base.WrapContents = value;
            }
        }

        public StackPanel()
        {
            InitializeComponent();
            this.FlowDirection = FlowDirection.TopDown;
            this.WrapContents = false;

            
        }

  

        protected override void OnResize(EventArgs eventargs)
        {
            foreach (Control c in this.Controls)
            {
                c.MinimumSize = new Size(this.Width - 25, c.MinimumSize.Height);
                c.Width = this.Width - 25;
               
            }
            base.OnResize(eventargs);
        }


        protected override void OnControlAdded(ControlEventArgs e)
        {
            e.Control.MinimumSize = new Size(this.Width - 25, e.Control.MinimumSize.Height);
            e.Control.Width = this.Width - 25;
            base.OnControlAdded(e);
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            // TODO: Add custom paint code here

            // Calling the base class OnPaint
            base.OnPaint(pe);
        }

    
    }
}
